load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "kv",
    srcs = [
        "cachedb.go",
        "checker.go",
        "error.go",
        "fault_injection.go",
        "iter.go",
        "key.go",
        "keyflags.go",
        "kv.go",
        "mpp.go",
        "option.go",
        "txn.go",
        "txn_scope_var.go",
        "unistore.go",
        "utils.go",
        "variables.go",
        "version.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/kv",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/config/kerneltype",
        "//pkg/errno",
        "//pkg/keyspace",
        "//pkg/meta/model",
        "//pkg/parser",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/resourcegroup",
        "//pkg/types",
        "//pkg/util/codec",
        "//pkg/util/dbterror",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/memory",
        "//pkg/util/resourcegrouptag",
        "//pkg/util/set",
        "//pkg/util/size",
        "//pkg/util/tiflash",
        "//pkg/util/tiflashcompute",
        "//pkg/util/trxevents",
        "@com_github_coocood_freecache//:freecache",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/deadlock",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_kvproto//pkg/mpp",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_tikv_client_go_v2//kv",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@com_github_tikv_client_go_v2//tikvrpc/interceptor",
        "@com_github_tikv_client_go_v2//util",
        "@com_github_tikv_pd_client//:client",
        "@com_github_tikv_pd_client//http",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "kv_test",
    timeout = "short",
    srcs = [
        "checker_test.go",
        "error_test.go",
        "fault_injection_test.go",
        "interface_mock_test.go",
        "key_test.go",
        "kv_test.go",
        "main_test.go",
        "mock_test.go",
        "option_test.go",
        "txn_test.go",
        "utils_test.go",
        "version_test.go",
    ],
    embed = [":kv"],
    flaky = True,
    shard_count = 27,
    deps = [
        "//pkg/config/kerneltype",
        "//pkg/keyspace",
        "//pkg/meta/model",
        "//pkg/parser",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/vardef",
        "//pkg/testkit/testsetup",
        "//pkg/testkit/testutil",
        "//pkg/types",
        "//pkg/util/codec",
        "//pkg/util/resourcegrouptag",
        "//pkg/util/size",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_kvproto//pkg/coprocessor",
        "@com_github_pingcap_kvproto//pkg/deadlock",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@org_uber_go_goleak//:goleak",
    ],
)
